//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __POWERDEF_H__
#define __POWERDEF_H__

typedef enum
{
    Lowest=1,
    VeryLow,
    Low,
    Medium,
    High,
    VeryHigh,
    Heightest
} Mode;

typedef enum
{
    AVG=1,
    PAST,
    STEPPED,
    LONGRUN,
    PEAK
} PolicyType;

typedef enum
{
    NoGroup=0,
    DefaultGroup,
    UserDefinedModeGroup,
    UserDefinedPolicyGroup
} TaskGroup;

typedef enum
{
    DevicePowerOff=0,
    DeviceSuspend=1,
    DeviceVeryLowPower=2,
    DeviceLowPower=3,
    DevicePowerOn=4
} DeviceMode;

#define MaxTask 10

typedef struct _Task_Power
{
    int TaskID;
    bool IsUsed;
    TaskGroup task_group;
    PolicyType policy_type;
    Mode mode;
    DeviceMode lcd_mode;//later we will support more device,but now lcd is necessary.
    unsigned long  lcd_keepon;
    unsigned long  lcd_interval;
    bool       auto_lcd_mode;
}Task_Power;

//typedef struct _Device_Table
//{
//    DeviceMode      mode;
//    unsigned long   keepon;
//    unsigned long   interval;
//    unsigned long   reserved;
//}DeviceTable;

//other misc function or macros
#if defined (_win32) || defined(_wince) || defined(_linux)
#define DebugOut(a)
#define DebugPrint printf
#define PowerCreateThread(a,b,c,d,e) _CThread_New((PThreadMain)a,b,c,e)
#define PowerFindService(a,b) _CSystem_FindRunningObject(a,b)
#define PowerMutex IMutex *
#define PowerEvent IEvent *
#define POWER_MAX_TIME 1000
#define POWER_THREAD_FLAG 0
#define POWER_THREAD_TYPE int
#elif defined(_zener)
#define DebugPrint kprintf
#define DebugOut(a)
#define PowerCreateThread DzCreateKernelThread
#define PowerFindService(a,b) DzFindService((const wchar_t *)(a),b)
#define PowerMutex DzMutex *
#define PowerEvent DzEvent *
#define POWER_MAX_TIME 100
#define POWER_THREAD_FLAG CreateThreadFlag_System
#define POWER_THREAD_TYPE int
#endif

#endif
